package thread2;

public class JoinDemo implements Runnable {
    public static void main(String[] args) {
        JoinDemo demo = new JoinDemo();
        Thread thread = new Thread(demo);
        thread.start();

        thread.setPriority(1);
        thread.getPriority();

        for (int i = 0; i < 50; i++) {
            if (i == 25) {
                try {
                    thread.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("main " + i);
        }
    }

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("join " + i);
        }
    }
}
